/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.S200;
import queenb.net.entitybean.S250;
import queenb.web.inteface.S250Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author VANANH
 */
public class S250Store extends S250 implements S250Inf {

    @Override
    public List<S250> getListS200All(int pnFH000, int pnFH200, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_S250, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, S250.class);
        } catch (SQLException ex) {
            Logger.getLogger(S250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(S250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(S250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int updateS250(int pnFH000, int pnFH200, int pnPS250, int pnFC450, int pvFC550, String pvSV251, String pvSV252, String pvSV253, String pvSV254, int pnSN255, int pnSN256, String pvLOGIN) {
        DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_S250, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnPS250),
                    new Param(OracleTypes.INTEGER, pnFC450),
                    new Param(OracleTypes.INTEGER, pvFC550),
                    new Param(OracleTypes.CHAR, pvSV251),
                    new Param(OracleTypes.CHAR, pvSV252),
                    new Param(OracleTypes.CHAR, pvSV253),
                    new Param(OracleTypes.CHAR, pvSV254),
                    new Param(OracleTypes.INTEGER, pnSN255),
                    new Param(OracleTypes.INTEGER, pnSN256),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(dataStetament, S250.class);
        } catch (SQLException ex) {
            Logger.getLogger(S250Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public int delete(int pnPS250, String pvLOGIN) {
       try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_S250, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPS250),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, S250.class);
        } catch (SQLException ex) {
            Logger.getLogger(S250Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public List<S250> getListCombS250(int pnFH000, int pnFH200S, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_COMBS250, OracleTypes.CURSOR, new Param[]{
                                                             new Param(OracleTypes.INTEGER, pnFH000),
                                                              new Param(OracleTypes.INTEGER, pnFH200S),
                                                             new Param(OracleTypes.CHAR, pvLOGIN)
             });
             return super.find(dataStatement, S250.class);
        } catch (SQLException ex) {
            Logger.getLogger(S250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(S250Store.class.getName()).log(Level.SEVERE, null, ex);
             return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(S250Store.class.getName()).log(Level.SEVERE, null, ex);
             return null;
        }
    }
}
